#pragma once
#include "MarkovPatterns.h"
#include "dataTypes.h"
#include <vector>
#include <map>
using namespace std;

class Pair
{
	public:
		Pair()
		{
			a = 'a';
			b = 'b';
		}

		Pair(char aA, char aB)
		{
			a = aA;
			b = aB;
		}

		char Get(int aI)
		{
			if(aI == 0) return a;
			else return b;
		}

		char& operator[](int aI)
		{
			if(aI == 0) return a;
			else if(aI == 1) return b;
			else return a;
		}

		bool operator<(const Pair& aPair) const
		{
			if(aPair.a > a) return true;
			if(aPair.a == a)
			{
				if(aPair.b > b) return true;
			}
			return false;
		}

		void Dump() const
		{
			printf("%c%c", a,b);
		}

	private:
		char a;
		char b;
};

class NameGenerator
{
public:
	static string GenerateName(int aRace, bool aMale);
	static string GenerateCityName();

	~NameGenerator();

private:
	NameGenerator();

	static void ParseData();

	static vector<vector<Pair>> startingLetters;
	static vector<map<Pair, vector<char>>> lettersOrder;

	static vector<Pair>* pStartingLetters;
	static map<Pair, vector<char>>* pLettersOrder;
};

